<!DOCTYPE HTML>
<html>
	<head>
		<title>FoodieShop</title>
    
		<link href="css/bootstrap.css" rel='stylesheet' type='text/css' />
		<script src="js/jquery.min.js"></script>
		<script src="js/bootstrap.min.js"></script>

		<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
        <script src="vendors/jquery-1.9.1.min.js"></script>
        <script src="bootstrap/js/bootstrap.min.js"></script>
        <script src="vendors/easypiechart/jquery.easy-pie-chart.js"></script>
        <script src="assets/scripts.js"></script>
        
        
        <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
        <link href="bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" media="screen">
        <link href="assets/styles.css" rel="stylesheet" media="screen">
        <link href="assets/DT_bootstrap.css" rel="stylesheet" media="screen">
  
		<!-- Custom Theme files -->
		<link href="css/style.css" rel='stylesheet' type='text/css' />
		<!-- Custom Theme files -->
		<meta name="viewport" content="width=device-width, initial-scale=1">
        <script type="application/x-javascript"> addEventListener("load", function() {
				setTimeout(hideURLbar, 0); }, false); function hideURLbar(){
				window.scrollTo(0,1); } 
            
            var email;
            (function($) {
                $.extend({       
                    urlGet:function()
                    {
                        var aQuery = window.location.href.split("?");  //取得Get参数
                        var getdata = aQuery[1].split("=");
                        email = getdata[1];
                    
                    }
                })
            })(jQuery);
            
        
        </script>

			<!----webfonts-- -->
			<!---<link href='http://fonts.googleapis.com/css?family=Exo+2:100,200,300,400,500,600,700,800,900' 
				rel='stylesheet' type='text/css'>- -->
	</head>
	<body>
		<div class="header">
			<div class="container">
				<div class="header_top">
					<ul class="phone">
						<li class="phone_left">
							<i class="mobile">
							</i>
							<span>000-12345678</span>
						</li>
						<li class="phone_right">每例订单收取 2元 配送费，订单超过 20元 免费配送哦！</li>
						<div class="clearfix"></div>
					</ul>
					<ul class="social">
						<li>
							<a href="">
								<i class="tw">
								</i>
							</a>
						</li>
						<li>
							<a href="">
								<i class="fb">
								</i>
							</a>
						</li>
						<li>
							<a href="">
								<i class="rss">
								</i>
							</a>
						</li>
						<li>
							<a href="">
								<i class="msg">
								</i>
							</a>
						</li>
						<div class="clearfix">
						</div>
					</ul>
					<ul class="account">
						<li>
							<a href="account.html">我的账户</a>
						</li>
					</ul>
				
					<div class="clearfix"></div>
				</div>
				<div class="header_bottom">
					<div class="header_nav">
						<div class="logo">
							<h2>
								<a class="city-info__name" id="city" href="index.html"
									gaevent="header/cityname">南通</a>
							</h2>
							<p>
								【
								<a class="city-info__toggle" href="adress.html" gaevent="header/changecity">切换城市</a>
								】
							</p>
						</div>
						<nav class="navbar navbar-default menu" role="navigation">
							<h3 class="nav_right">
								<a href="index.html">
									<img src="images/logo.png" class="img-responsive" alt="" />
								</a>
							</h3>
							<div class="container-fluid">
								<!-- Brand and toggle get grouped for better mobile display -->
								<div class="navbar-header">
									<button type="button" class="navbar-toggle" data-toggle="collapse"
										data-target="#bs-example-navbar-collapse-1">
										<span class="sr-only">导航</span>
										<span class="icon-bar"></span>
										<span class="icon-bar"></span>
										<span class="icon-bar"></span>
									</button>
								</div>
								<!-- Collect the nav links, forms, and other content for toggling -->
								<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
									<ul class="nav navbar-nav menu1">
										<li class="active">
											<a href="#" onclick="gotoShow();">查看所有商品</a>
										</li>
										
									</ul>
									<ul class="login">
										<a href="login.html">
											<li class="login_top">
												<i class="sign">
												</i>
												<span>安全退出</span>
											</li>
										</a>
										
									</ul>
									<div class="clearfix"></div>
								</div><!-- /.navbar-collapse -->
							</div><!-- /.container-fluid -->
						</nav>
						<div class="clearfix"></div>
					</div>
<!--
					<div class="search">
						 <input type="text" class="text" value="请输入您要查找的商品或店铺"
							onfocus="this.value = '';" onblur="if (this.value == '') {this.value = '请输入您要查找的商品或店铺';}">
							<input type="submit" value="查找"> 
							<h2 class="search_title">商家注册</h2>
					</div>
-->
				</div>
			</div>
		</div>
	
        
        <div class="jumbotron main">
            <h1>欢迎光临，商铺后台管理系统!</h1>
            <p><img src="images/mybg.jpg"></p>
        </div>
        <div id="myAddFood">
        
             <div class="row-fluid">
                      
                        <div class="block">
                            <div class="navbar navbar-inner block-header">
                
                                <button class="btn btn-success btn-large" onclick="gotoShow();">返回上一步</button>
                            </div>
                             <div class="block-content collapse in">
                                <div class="span12">
                                    <form class="form-horizontal" action="addFood" enctype="multipart/form-data" method="post">
                                      <fieldset>
                                        <legend>填写商品的详细信息</legend>
                                        <div class="control-group">
                                          <label class="control-label" for="typeahead">商品名： </label>
                                          <div class="controls">
                                            <input type="text" class="span6" name="commodityName"  data-provide="typeahead" data-items="4" >
                                            <p class="help-block">请填写完整的名称</p>
                                          </div>
                                        </div>
                                        <div class="control-group">
                                          <label class="control-label" for="date01">输入数量：</label>
                                          <div class="controls">
                                            <input type="text" class="input-xlarge datepicker" id="date01" name="commodiryNum">
                                            <p class="help-block">请输入库存数量，数据必须是整数.</p>
                                          </div>
                                        </div>
                                          <div class="control-group">
                                          <label class="control-label" for="date01">输入价格：</label>
                                          <div class="controls">
                                            <input type="text" class="input-xlarge datepicker" id="date01" name="commodityPrice">
                                            <p class="help-block">请输入商品价格，数据必须是整数.</p>
                                          </div>
                                        </div>
                                          <div class="control-group">
                                          <label class="control-label" for="typeahead">商品编号： </label>
                                          <div class="controls">
                                            <input type="text" class="span6" name="commodityCode"  data-provide="typeahead" data-items="4" >
                                            <p class="help-block">谨慎输入!</p>
                                          </div>
                                        </div>
                                        <div class="control-group">
                                          <label class="control-label" for="optionsCheckbox">商品状态：</label>
                                          <div class="controls">
                                            <label class="uniform">
                                              <input class="uniform_on" type="checkbox" id="optionsCheckbox" value="1" name="commodiryStatus">
                                              是否上架，勾选表示上架
                                            </label>
                                          </div>
                                        </div>
                                        <div class="control-group">
                                          <label class="control-label" for="select01">商品折扣：</label>
                                          <div class="controls">
                                            <select id="select01" class="chzn-select" name="commodityDiscount">
                                              <option value="1">不打折</option>
                                              <option value="0.9">9折</option>
                                              <option value="0.8">8折</option>
                                              <option value="0.7">7折</option>
                                              <option value="0.5">5折</option>
                                            </select>
                                          </div>
                                        </div>
                                        <div class="control-group">
                                          <label class="control-label" for="multiSelect">选择类型：</label>
                                          <div class="controls">
                                            <select multiple="multiple" id="multiSelect" class="chzn-select span4" name="commodityType">
                                              <option>水果</option>
                                              <option>家具</option>
                                              <option>食品</option>
                                              <option>家电</option>
                                            </select>
                                          
                                          </div>

                                        </div>
                                        <div class="control-group">
                                          <label class="control-label" for="fileInput">选择图片：</label>
                                          <div class="controls">
                                            <input class="input-file uniform_on" id="fileInput" type="file" name="pictureUri">
                                          </div>
                                        </div>
                                        <div class="control-group">
                                          <label class="control-label" for="textarea2">商品描述：</label>
                                          <div class="controls">
                                            <textarea class="input-xlarge textarea" placeholder="请输入描述信息 ..." style="width: 810px; height: 200px" name="commodityTip"></textarea>
                                          </div>
                                        </div>
                                        <div class="form-actions">
                                          <button type="submit" class="btn btn-primary">提交</button>
                                          <button type="reset" class="btn">重置</button>
                                        </div>
                                      </fieldset>
                                    </form>

                                </div>
                            </div>
                        </div> 
                        
                    </div> 
        
             
        
        </div>
        
        
        
        
        
        <div id="myFoodTable">
                    <div class="row-fluid">
                        <!-- block -->
                        <div class="block">
                            <div class="navbar navbar-inner block-header">
                                <div class="muted pull-left">所有商品</div>
                            </div>
                            <div class="block-content collapse in">
                                <div class="span12">
                                   <div class="table-toolbar">
                                      <div class="btn-group">
                                         <a href="#" onclick="addFood();"><button class="btn btn-success">添加商品 <i class="icon-plus icon-white"></i></button></a>
                                      </div>
                                   </div>
                                    
                                    <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="example2">
                                        <thead>
                                            <tr>
                                                <th>编号</th>
                                                <th>商品</th>
                                                <th>商品名称</th>
                                                <th>商品价格</th>
                                                <th>商品数量</th>
                                                <th>商品介绍</th>
                                            </tr>
                                        </thead>
                                        <tbody id="main">
                                           
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                        <!-- /block -->
                    </div>
        
        </div>

		<div class="footer">
			<div class="container">
				<div class="footer-grid footer-grid1">
					<h3 class="m_2">公司信息</h3>
					<ul class="list1">
						<li>
							<a href="#">公司主页</a>
						</li>
						<li>
							<a href="#">关于我们</a>
						</li>
						<li>
							<a href="#">最新消息</a>
						</li>
						<li>
							<a href="#">加入我们</a>
						</li>
					</ul>
				</div>
				<div class="footer-grid footer-grid2">
					<h3 class="m_2">合作伙伴</h3>
					<ul class="list1">
						<li>
							<a href="#">xxxxxxx</a>
						</li>
						<li>
							<a href="#">xxxxxxx</a>
						</li>
						<li>
							<a href="#">xxxxxxx</a>
						</li>
						<li>
							<a href="#">xxxxxxx</a>
						</li>
						<li>
							<a href="#">xxxxxxx</a>
						</li>
						<li>
							<a href="#">xxxxxxx</a>
						</li>
					</ul>
				</div>
				<div class="footer-grid footer-grid3">
					<h3 class="m_2">用户帮助</h3>
					<ul class="list1">
						<li>
							<a href="#">申请退款</a>
						</li>
						<li>
							<a href="#">常见问题</a>
						</li>
						<li>
							<a href="#">用户协议</a>
						</li>
					</ul>
				</div>
				<div class="footer-grid footer-grid_last">
					<ul class="secure">
						<li class="secure_img">
							<img src="images/secure.png" alt="" />
						</li>
						<li class="secure_desc"></li>
						<div class="clearfix">
						</div>
					</ul>
					<ul class="secure">
						<li class="secure_img"></li>
						<li class="secure_desc">小二喊你来</li>
						<span>foodShopping</span>
						<li class="secure_desc">啦！</li>
						<div class="clearfix">
						</div>
					</ul>
				</div>
				<div class="clearfix">
				</div>
				<div class="copy">
					<!-- <p>Copyright &copy;
						2014.Company name All rights reserved.
						<a target="_blank" href="http://sc.chinaz.com/moban/">&#x7F51;&#x9875;&#x6A21;&#x677F;</a>
					</p> -->
				</div>
			</div>
		</div>
		<div style="display:none">
			<script src='http://v7.cnzz.com/stat.php?id=155540&web_id=155540'
				language='JavaScript' charset='gb2312'></script>
		</div>
        
        
         <script src="vendors/jquery-1.9.1.js"></script>
        <script src="bootstrap/js/bootstrap.min.js"></script>
        <script src="vendors/datatables/js/jquery.dataTables.min.js"></script>


        <script src="assets/scripts.js"></script>
        
        
        
    <script>
        
        var comm = null;
        var myFoodTable = $("#myFoodTable");
        var myAddFood = $("#myAddFood");
        var main = $("#main");
        
        function downloadJSAtOnload() {
                var element = document.createElement("script");
                element.src = "assets/DT_bootstrap.js";
                document.body.appendChild(element);
            }
            if (window.addEventListener)
                window.addEventListener("load", downloadJSAtOnload, false);
            else if (window.attachEvent)
                window.attachEvent("onload", downloadJSAtOnload);
            else window.onload = downloadJSAtOnload;
        
        myAddFood.hide();
        myFoodTable.hide();
        
      /* 显示商品 */
				 $.getJSON(
						"showFood",
						function(data) {
                            if(data == null) {
                                alert("还没有商品");
                            }
						    comm=data;
                         
							for (var i = 0; i < data.length; i++) {
                                

								var status = null;
                                main.append("<tr><td>" + data[i]['commodityCode']+ "</td><td> <img src='"+
                                           data[i]['pictureUri']+"'></td><td>"+ 
                                           data[i]['commodityName']+"</td><td>"+
                                            data[i]['commodityPrice']+"</td><td>"+
                                            data[i]['commodiryNum']+"</td><td>"+
                                            data[i]['commodityTip']+"</td></tr>"    
                                );

							}
						});
		
        function addFood() {
            $("#myFoodTable").hide();
            $("#myAddFood").show();
            
        }
        function gotoShow() {
            $(".jumbotron").hide();
            $("#myFoodTable").show();
            $("#myAddFood").hide();
        }
        
        
    </script>
	</body>
</html>

